package com.mvc.base.web;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.mvc.base.model.Notice;
import com.mvc.base.service.NoticeManager;
import com.mvc.framework.service.PageManager;
import com.mvc.framework.util.PageSearch;
import com.mvc.framework.web.PageController;
import com.mvc.security.model.User;
import com.mvc.security.service.UserManager;

@Controller
@RequestMapping("notice")
public class NoticeController extends PageController<Notice> {
	@Autowired
	private NoticeManager noticeManager;

	@Autowired
	private UserManager<User> userManager;

	protected String handlePage(HttpServletRequest request, PageSearch page) {
		request.setAttribute("users", userManager.getAll());
		return super.handlePage(request, page);
	}

	@Override
	public PageManager<Notice> getEntityManager() {
		return noticeManager;
	}

	@Override
	public String getFileBasePath() {
		return "base/";
	}
}
